
shannon_entropy = function(probs, normalized=FALSE){
  p = which(probs > 1e-30)
  entropy = -sum(probs[p]*log(probs[p]))
  if(normalized){
    entropy = entropy/log(length(probs))
  }
  return(entropy)
}






